# Maintainer: Caleb Maclennan <caleb@alerque.com>

pkgname=python-pyppmd
_pyname=${pkgname#python-}
pkgver=1.0.0
pkgrel=2
pkgdesc='PPM compression/decompression library'
arch=(loong64 x86_64)
url="https://codeberg.org/miurahr/$_pyname"
license=(LGPL)
depends=(python)
makedepends=(python-{build,installer,wheel}
             python-setuptools-scm)
checkdepends=(python-pytest-benchmark python-py-cpuinfo python-hypothesis)
_archive="$_pyname-$pkgver"
source=("https://files.pythonhosted.org/packages/source/${_pyname::1}/${_pyname}/$_archive.tar.gz")
sha256sums=('075c9bd297e3b0a87dd7aeabca7fee668218acbe69ecc1c6511064558de8840f')

build() {
	cd "$_archive"
	python -m build -wn
}

check() {
	cd "$_archive"
	local _pyver=cpython-$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
	export PYTHONPATH="$PWD/build/lib.linux-$CARCH-$_pyver"
	python -m pytest
}

package() {
	cd "$_archive"
	python -m installer -d "$pkgdir" dist/*.whl
}
